package com.jch.dm4_promise.examples1;

// 角色：Future 或 Promise
public class RealData implements Data {

    private final String content;

    public RealData(int count,char c){
        System.out.println("  making RealData(" + count + "," + c +") BEGIN");
        char[] buffer = new char[count];
        for (int i = 0; i < count; i++) {
            buffer[i] = c;
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
            }
        }
        System.out.println("  making RealData(" + count +","+c+") END");
        this.content = new String(buffer);
    }

    @Override
    public String getContent() {
        return content;
    }
}
